package com.wapchief.jpushim.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.wapchief.jpushim.greendao.model.User;
import com.wapchief.jpushim.greendao.model.SearchAdd;
import com.wapchief.jpushim.greendao.model.RequestList;
import com.wapchief.jpushim.greendao.model.ChatLog;

import com.wapchief.jpushim.greendao.UserDao;
import com.wapchief.jpushim.greendao.SearchAddDao;
import com.wapchief.jpushim.greendao.RequestListDao;
import com.wapchief.jpushim.greendao.ChatLogDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userDaoConfig;
    private final DaoConfig searchAddDaoConfig;
    private final DaoConfig requestListDaoConfig;
    private final DaoConfig chatLogDaoConfig;

    private final UserDao userDao;
    private final SearchAddDao searchAddDao;
    private final RequestListDao requestListDao;
    private final ChatLogDao chatLogDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        searchAddDaoConfig = daoConfigMap.get(SearchAddDao.class).clone();
        searchAddDaoConfig.initIdentityScope(type);

        requestListDaoConfig = daoConfigMap.get(RequestListDao.class).clone();
        requestListDaoConfig.initIdentityScope(type);

        chatLogDaoConfig = daoConfigMap.get(ChatLogDao.class).clone();
        chatLogDaoConfig.initIdentityScope(type);

        userDao = new UserDao(userDaoConfig, this);
        searchAddDao = new SearchAddDao(searchAddDaoConfig, this);
        requestListDao = new RequestListDao(requestListDaoConfig, this);
        chatLogDao = new ChatLogDao(chatLogDaoConfig, this);

        registerDao(User.class, userDao);
        registerDao(SearchAdd.class, searchAddDao);
        registerDao(RequestList.class, requestListDao);
        registerDao(ChatLog.class, chatLogDao);
    }
    
    public void clear() {
        userDaoConfig.clearIdentityScope();
        searchAddDaoConfig.clearIdentityScope();
        requestListDaoConfig.clearIdentityScope();
        chatLogDaoConfig.clearIdentityScope();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public SearchAddDao getSearchAddDao() {
        return searchAddDao;
    }

    public RequestListDao getRequestListDao() {
        return requestListDao;
    }

    public ChatLogDao getChatLogDao() {
        return chatLogDao;
    }

}
